package com.lagou.demo.controller;

import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Title: mvc
 * @Description:
 * @Author: Wenfeng Cheng
 * @Date: 2021-01-18 15:06
 * @Version: 1.0.0
 */
@LagouController
@LagouRequestMapping("/demo")
@Security({})
public class DemoController {

    @LagouAutowired
    private IDemoService demoService;

    /**
     * URL: /demo/query?name=lisi
     * @param request
     * @param response
     * @param name
     * @return
     */
    @LagouRequestMapping("/query")
    @Security({"zhangsan"})
    public String query(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }

    @LagouRequestMapping("/handle01")
    @Security({"zhangsan","lisi"})
    public String handle01(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("handle01");
        return "handle01";
    }

    @LagouRequestMapping("/handle02")
    @Security({"wangwu"})
    public String handle02(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("handle02");
        return "handle02";
    }
}
